import { createApp, h } from 'vue'
import App from './App.vue'

import Page01 from './components/Page01.vue'
import Page02 from './components/Page02.vue'
import Page03 from './components/Page03.vue'
import Page04 from './components/Page04.vue'
import NotFound from './components/NotFound.vue'

const routes = {
    '/': App,
    '/page01': Page01,
    '/page02': Page02,
    '/page03': Page03,
    '/page04': Page04,
}

const router = {
    data() {
        return {
            currentRoute: window.location.pathname
        }
    },
    computed: {
        CurrentComponent() {
            return routes[this.currentRoute] || NotFound
        }
    },
    render() {
        return h(this.CurrentComponent)
    }
}

createApp(router).mount('#app')
